package com.itheima.service.db.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.itheima.domain.db.Questions;
import com.itheima.mapper.QuestionsMapper;
import com.itheima.service.db.QuestionsService;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

@DubboService
public class QuestionsServiceImpl implements QuestionsService {
    @Autowired
    QuestionsMapper questionsMapper;

    @Override
    public List<Questions> findByNaireId(Long id) {
        LambdaQueryWrapper<Questions> lqw = new LambdaQueryWrapper<>();
        lqw.eq(Questions::getNaireId, id);
        return questionsMapper.selectList(lqw);
    }

    @Override
    public Questions findNaire(Long questionId) {
        return questionsMapper.selectById(questionId);
    }
}
